package com.atguigu.tingshu.enums;

import lombok.Getter;

@Getter
public enum AlbumStatType {
    PLAY_STAT_NUM("0401", "播放量", "play_stat_num"),
    SUB_SCRIBE_STAT_NUM("0402", "订阅量", "subscribe_stat_num"),
    BUY_STAT_NUM("0403", "购买量", "buy_stat_num"),
    COMMENT_STAT_NUM("0404", "评论数", "comment_stat_num"),
    ;

    private final String code;
    private final String value;
    private final String name;

    AlbumStatType(String code, String value, String name) {
        this.value = value;
        this.code = code;
        this.name = name;
    }

    public static String getValueByCode(String code) {
        for (AlbumStatType value : values()) {
            if (value.code.equals(code)) {
                return value.value;
            }
        }
        return null;
    }

    public static String getCodeByValue(String value) {
        for (AlbumStatType value1 : values()) {
            if (value1.value.equals(value)) {
                return value1.code;
            }
        }
        return null;
    }
}
